auto();
setScreenMetrics(1080,2400);

app.launchApp("掌上蔚园");

function findAndClickByText(str,timeout) {
    var button=text(str).findOne(timeout);
    if(button) {
        var r=button.bounds();
        click(r.centerX(),r.centerY());
    }
    else exit();
}

findAndClickByText("健康打卡",20000);
findAndClickByText("学生每日健康打卡",10000);

var bt1=text("确定").findOne(10000);
if(bt1) {
    var r=bt1.bounds();
    click(r.centerX(),r.centerY());
}
else {
    exit();
}

for(var i=0;i<5;i++) {
    sleep(1000);
    swipe(500,2000,500,100,300);
    if(text("提交").exists()) {
        console.log("111");
        findAndClickByText("提交",3000);
        break;
    }
    
}